package java_thinking.unit_19._19_1_6;

/**
 * @Desc:   枚举中添加方法
 * @author: cww
 * @DateTime: 2019-05-21 23:09
 */
public enum OzWitch {
    WEST("Miss Gulch, aka the Wicked Witch of the West"),
    NORTH("Glinda the Good Witch of the North"),
    EAST("Wicked Witch of the East, wear of the Ruby Slippers, crushed by Dorothy's house"),
    SOUTH("Good by inference, but missing");
    private String description;

    /**
     * 此处将构造器声明为private,但对于它的可访问性并没有什么变化，因为即使不声明为private，我们只能在enum定义的内部使用
     * 其构造器创建enum实例，一但enum的定义结束，编译期不允许我们再使用其构造器来创建任何实例；
     * @param description
     */
    private OzWitch(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    public static void main(String[] args) {
        for (OzWitch witch : OzWitch.values()) {
            System.out.println(witch + ": " + witch.getDescription());
        }
    }
}
